﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="SharingCenter.Web.Admin.Posts.List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
话题列表 - <%=_category.CategoryName %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2 class="w5">
    <span class="nss ns-doc"></span>
    话题列表 - <%=_category.CategoryName %></h2>
    <a href="Category.aspx">&lt;返回</a>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSource1" DataKeyNames="ThreadId">
            <ItemTemplate>
                <tr class="ti">
                    <td class="r">
                        <asp:Label ID="TotalPostsLabel" runat="server" Text='<%# Convert.ToInt32(Eval("TotalPosts"))-1 %>' />
                    </td>
                    <td class="v">
                        <asp:Label ID="ViewCountLabel" runat="server" Text='<%# Eval("ViewCount") %>' />
                    </td>
                    <td class="t">
                        <table cellspacing="0" cellpadding="0" class="nobdr">
                            <tr>
                                <td>
                                    <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("ThreadIcon", "~/Content/images/threadicons/{0}") %>'
                                        Visible='<%#Eval("ThreadIcon").ToString()!=""%>' />
                                </td>
                                <td>
                                    <asp:HyperLink Target="postwindow" ID="MainPostIdLabel" runat="server" Text='<%# Eval("PostTitle") %>'
                                        NavigateUrl='<%#Eval("ThreadId", "~/Mod/Talks/Thread.aspx?t={0}&u=1") %>' />
                                </td>
                                <td>
                                    <asp:Panel runat="server" CssClass="nss ns-hot" title="热" ID="pnHot">
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td class="cu">
                        <cc:AvatarImage ID="AvatarImage1" runat="server" UserId='<%# Eval("CreatorUserId") %>' AlternateText="" AvatarType="Tiny" />
                        <cc:NickNameLink ID="NickNameLink1" runat="server" UserId='<%# Eval("CreatorUserId") %>' />
                    </td>
                    <td class="cd">
                        <asp:Label ID="Label1" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("CreateDate"), SharingCenter.Web.Classes.TimeDisplayEnum.LiteralHours, false) %>' />
                    </td>
                    <td class="lu">
                        <asp:Label ID="LastUpdateLabel" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("LastUpdate"), SharingCenter.Web.Classes.TimeDisplayEnum.LiteralHours, false) %>' />
                    </td>
                    <td style="width:150px;">
                        <asp:LinkButton ID="LinkButton1" runat="server" Visible='<%#Eval("IsHot") %>' CommandName="SetHot">取消热</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" Visible='<%#!Convert.ToBoolean(Eval("IsHot")) %>' CommandName="CancelHot">设置热</asp:LinkButton>
                        |
                        <asp:LinkButton ID="LinkButton4" runat="server" Visible='<%#Eval("IsRecommended") %>' CommandName="CancelTopThread">取消置顶</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton5" runat="server" Visible='<%#!Convert.ToBoolean(Eval("IsRecommended")) %>' CommandName="TopThread">置顶</asp:LinkButton>
                        |
                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="DeleteThread">删除</asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
            <EmptyDataTemplate>
                <div class="litetext">
                    目前没有话题。</div>
            </EmptyDataTemplate>
            <LayoutTemplate>
                <table  border="0" class="tlist" cellspacing="0">
                   <tbody>
                        <tr class="th">
                            <th class="r">
                                回复
                            </th>
                            <th class="v">
                                阅读
                            </th>
                            <th class="t">
                                主题
                            </th>
                            <th class="cu">
                                作者
                            </th>
                            <th class="cd">
                                发表时间
                            </th>
                            <th class="lu">
                                最后更新
                            </th>
                            <th>
                                操作
                            </th>
                        </tr>
                        <tr id="itemPlaceholder" runat="server">
                        </tr>
                    </tbody>
                </table>
                <div class="actionarea">
                    <asp:DataPager ID="DataPager1" runat="server" PageSize="30" QueryStringField="p">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="首页" ShowFirstPageButton="True"
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField ButtonType="Link" LastPageText="末页" ShowLastPageButton="True"
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
        </asp:ListView>
        </ContentTemplate>
    </asp:UpdatePanel>

        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
            EnableDelete="True" EnableUpdate="True" TableName="ThreadWithMainPosts" OrderBy="IsRecommended desc, LastUpdate desc"
            AutoGenerateWhereClause="true">
            <WhereParameters>
                <asp:QueryStringParameter DbType="Guid" Name="CategoryId" QueryStringField="c" />
            </WhereParameters>
        </asp:LinqDataSource>
</asp:Content>
